home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
bbs
/
mhis020.zip
/
CALLAVG.MH
< prev
next >
Wrap
Text File
|
1996-12-21
|
2KB
|
70 lines
#ifndef __CALLAVG_MH
#define __CALLAVG_MH
#ifndef __CALLSTAT_MH
#include "callstat.mh"
#endif
void stats_average (Ref struct _callstats: stats, long: min, long: max) {
int: last_day, counter;
long: idx;
struct _callinfo: ci;
stats_clear (stats);
idx := min;
print (COL_YELLOW);
while ((idx <= max) AND call_read(idx, ci)) {
if (counter = 0) {
counter := 20;
print ((idx - min) * 100 / (max - min), "%\r");
};
counter := counter - 1;
if (ci.logoff.date.day <> last_day) {
stats.days := stats.days + 1;
last_day := ci.logoff.date.day;
};
if (meets_criteria (ci, callers.criteria)) {
stats_add (stats, ci);
};
idx := idx + 1;
if (kbhit ()) {
getch ();
print (COL_WHITE, "Aborted\n");
return;
};
};
print (COL_WHITE, "Done\n");
}
#define STATS_TITLE_WIDTH 12
#define STATS_DATA_WIDTH 14
void stats_show_data (string: title, string: data) {
if (sys.current_col + STATS_TITLE_WIDTH + STATS_DATA_WIDTH > usr.width) {
print ('\n');
};
print (COL_CYAN, strpadleft (title + ": ", STATS_TITLE_WIDTH,' '),
COL_LMAGENTA, strpad (data, STATS_DATA_WIDTH, ' '));
}
string stats_value (long: value, long: fact) {
return (division_result (value, fact, 2));
}
void stats_show (struct _callstats: s, long: fact) {
stats_show_data ("Calls", stats_value (s.calls, fact));
stats_show_data ("Time", seconds_to_string (s.time / fact));
stats_show_data ("Files up", stats_value (s.filesup, fact));
stats_show_data ("Files down", stats_value (s.filesdn, fact));
stats_show_data ("Msg read", stats_value (s.read, fact));
stats_show_data ("Msg posted", stats_value (s.posted, fact));
stats_show_data ("Kb up", stats_value (s.kbup, fact));
stats_show_data ("Kb down", stats_value (s.kbdn, fact));
stats_show_data ("Pages", stats_value (s.paged, fact));
}
#endif